/**
 * Copyright (C) 2012 The SkyTvOS Project
 * <p/>
 * Version     Date           Author
 * ─────────────────────────────────────
 * 2015年3月18日         luwei
 */

package com.coocaa.app.gamecenter.pages.search;

import android.os.Bundle;
import android.view.KeyEvent;
import android.view.View;

import com.coocaa.app.gamecenter.framework.GameCenterActivity;
import com.coocaa.x.app.framework.app.LiteAppApplication;
import com.tianci.appstore.R;
import com.tianci.appstore.ui.search.SearchListView.OnShowLoadingListener;
import com.tianci.appstore.utils.SkyConstants;

import java.util.HashMap;
import java.util.Map;

public class GameSearchActivity extends GameCenterActivity implements OnShowLoadingListener {
    private GameSearchLayout mSearchLayout = null;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        // TODO Auto-generated method stub
        super.onCreate(savedInstanceState);
    }

    @Override
    protected Map<String, String> getPageStartParams() {
        HashMap<String,String> map = new HashMap<String,String>();
        return map;
    }

    @Override
    protected View createContentView() {
        mSearchLayout = new GameSearchLayout(this, this);
        return mSearchLayout;
    }

    @Override
    protected int getMarginLeft() {
        return SkyConstants.Div(320);
    }

    @Override
    protected void loadData() {

    }

    @Override
    public boolean onKeyDown(int keyCode, KeyEvent event) {
        if (mSearchLayout != null) {
            if (mSearchLayout.keyDown(keyCode, event)) {
                return true;
            }
        }
        return super.onKeyDown(keyCode, event);
    }

    @Override
    protected void updateContentView() {
        updateTitle(getString(R.string.search));
    }

    @Override
    public void showLoading(boolean show) {
        if (show) {
            showloading();
        } else {
            hideloading();
        }
    }

    @Override
    protected void onDestroy() {
        if (mSearchLayout != null) {
            mSearchLayout.setShowLoadingListener(null);
            mSearchLayout.destory();
        }
        super.onDestroy();
    }

    @Override
    public String getName() {
        return "酷游吧搜索页";
    }

}
